home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / DBL Pascal Library / Icons.p < prev    next >
Text File  |  1992-10-27  |  8KB  |  302 lines

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.2.    }
  2.  
  3. {
  4.     File:        Icons.p
  5.  
  6.     Contains:    Pascal interfaces for icon-handling routines
  7.  
  8.     Copyright:    © 1990, 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10. }
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18.  UNIT Icons;
  19.  INTERFACE
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. CONST
  40.  
  41. { The following are icons for which there are both icon suites and SICNs. }
  42. genericDocumentIconResource = -4000;
  43. genericStationeryIconResource = -3985;
  44. genericEditionFileIconResource = -3989;
  45. genericApplicationIconResource = -3996;
  46. genericDeskAccessoryIconResource = -3991;
  47.  
  48. genericFolderIconResource = -3999;
  49. privateFolderIconResource = -3994;
  50.  
  51. floppyIconResource = -3998;
  52. trashIconResource = -3993;
  53.  
  54. { The following are icons for which there are SICNs only. }
  55. desktopIconResource = -3992;
  56. openFolderIconResource = -3997;
  57. genericHardDiskIconResource = -3995;
  58. genericFileServerIconResource = -3972;
  59. genericSuitcaseIconResource = -3970;
  60. genericMoverObjectIconResource = -3969;
  61.  
  62. { The following are icons for which there are icon suites only. }
  63. genericPreferencesIconResource = -3971;
  64. genericQueryDocumentIconResource = -16506;
  65. genericExtensionIconResource = -16415;
  66.  
  67. systemFolderIconResource = -3983;
  68. appleMenuFolderIconResource = -3982;
  69. startupFolderIconResource = -3981;
  70. ownedFolderIconResource = -3980;
  71. dropFolderIconResource = -3979;
  72. sharedFolderIconResource = -3978;
  73. mountedFolderIconResource = -3977;
  74. controlPanelFolderIconResource = -3976;
  75. printMonitorFolderIconResource = -3975;
  76. preferencesFolderIconResource = -3974;
  77. extensionsFolderIconResource = -3973;
  78.  
  79. fullTrashIconResource = -3984;
  80.  
  81. large1BitMask = 'ICN#';
  82. large4BitData = 'icl4';
  83. large8BitData = 'icl8';
  84. small1BitMask = 'ics#';
  85. small4BitData = 'ics4';
  86. small8BitData = 'ics8';
  87. mini1BitMask = 'icm#';
  88. mini4BitData = 'icm4';
  89. mini8BitData = 'icm8';
  90.  
  91.  
  92.     { IconAlignmentType values    }
  93. atNone                =    $0;
  94. atVerticalCenter    =    $1;
  95. atTop                =    $2;
  96. atBottom            =    $3;
  97. atHorizontalCenter    =    $4;
  98. atAbsoluteCenter    =    (atVerticalCenter + atHorizontalCenter);
  99. atCenterTop            =    (atTop + atHorizontalCenter);
  100. atCenterBottom        =    (atBottom + atHorizontalCenter);
  101. atLeft                =    $8;
  102. atCenterLeft        =    (atVerticalCenter + atLeft);
  103. atTopLeft            =    (atTop + atLeft);
  104. atBottomLeft        =    (atBottom + atLeft);
  105. atRight                =    $C;
  106. atCenterRight        =    (atVerticalCenter + atRight);
  107. atTopRight            =    (atTop + atRight);
  108. atBottomRight        =    (atBottom + atRight);
  109.  
  110.     { IconTransformType values }
  111. ttNone                =    $0;
  112. ttDisabled            =    $1;
  113. ttOffline            =    $2;
  114. ttOpen                =    $3;
  115. ttLabel1            =    $0100;
  116. ttLabel2            =    $0200;
  117. ttLabel3            =    $0300;
  118. ttLabel4            =    $0400;
  119. ttLabel5            =    $0500;
  120. ttLabel6            =    $0600;
  121. ttLabel7            =    $0700;
  122. ttSelected            =    $4000;
  123. ttSelectedDisabled    =    (ttSelected + ttDisabled);
  124. ttSelectedOffline    =    (ttSelected + ttOffline);
  125. ttSelectedOpen        =    (ttSelected + ttOpen);
  126.     
  127.     { IconSelectorValue masks }
  128. svLarge1Bit            =    $00000001;
  129. svLarge4Bit            =    $00000002;
  130. svLarge8Bit            =    $00000004;
  131. svSmall1Bit            =    $00000100;
  132. svSmall4Bit            =    $00000200;
  133. svSmall8Bit            =    $00000400;
  134. svMini1Bit            =    $00010000;
  135. svMini4Bit            =    $00020000;
  136. svMini8Bit            =    $00040000;
  137. svAllLargeData        =    $000000ff;
  138. svAllSmallData        =    $0000ff00;
  139. svAllMiniData        =    $00ff0000;
  140. svAll1BitData        =    (svLarge1Bit + svSmall1Bit + svMini1Bit);
  141. svAll4BitData        =    (svLarge4Bit + svSmall4Bit + svMini4Bit);
  142. svAll8BitData        =    (svLarge8Bit + svSmall8Bit + svMini8Bit);
  143. svAllAvailableData    =    $ffffffff;
  144.     
  145. TYPE
  146.     IconAction            =    ProcPtr;    {
  147.                                             FUNCTION IconAction(theType: ResType;
  148.                                                         VAR theIcon: Handle;
  149.                                                         yourDataPtr: Ptr): OSErr;
  150. }
  151.                                         
  152.     IconGetter            =    ProcPtr;    {
  153.                                             FUNCTION IconGetter(theType: ResType;
  154.                                                         yourDataPtr: Ptr): Handle;
  155. }
  156.  
  157.     IconSelectorValue    =    LONGINT;
  158.     IconAlignmentType    =    INTEGER;
  159.     IconTransformType    =    INTEGER;
  160.  
  161.     FUNCTION PlotIconID(theRect: Rect;
  162.                         align: IconAlignmentType;
  163.                         transform: IconTransformType;
  164.                         theResID: INTEGER): OSErr;
  165.         INLINE    $303C, $0500, $ABC9;
  166.     
  167.     FUNCTION NewIconSuite(VAR theIconSuite: Handle): OSErr;
  168.         INLINE    $303C, $0207, $ABC9;
  169.     
  170.     FUNCTION AddIconToSuite(theIconData: Handle;
  171.                             theSuite: Handle;
  172.                             theType: ResType): OSErr;
  173.         INLINE    $303C, $0608, $ABC9;
  174.     
  175.     FUNCTION GetIconFromSuite(VAR theIconData: Handle;
  176.                             theSuite: Handle;
  177.                             theType: ResType): OSErr;
  178.         INLINE    $303C, $0609, $ABC9;
  179.     
  180.     FUNCTION ForEachIconDo(theSuite: Handle;
  181.                             selector: IconSelectorValue;
  182.                             action: IconAction;
  183.                             yourDataPtr: Ptr): OSErr;
  184.         INLINE    $303C, $060A, $ABC9;
  185.     
  186.     FUNCTION GetIconSuite(VAR theIconSuite: Handle;
  187.                             theResID: INTEGER;
  188.                             selector: IconSelectorValue): OSErr;
  189.         INLINE    $303C, $0501, $ABC9;
  190.     
  191.     FUNCTION DisposeIconSuite(theIconSuite: Handle;
  192.                             disposeData: BOOLEAN): OSErr;
  193.         INLINE    $303C, $0302, $ABC9;
  194.     
  195.     FUNCTION PlotIconSuite(theRect: Rect;
  196.                             align: IconAlignmentType;
  197.                             transform: IconTransformType;
  198.                             theIconSuite: Handle): OSErr;
  199.         INLINE    $303C, $0603, $ABC9;
  200.     
  201.     FUNCTION MakeIconCache(VAR theHandle: Handle;
  202.                             makeIcon: IconGetter;
  203.                             yourDataPtr: UNIV Ptr): OSErr;
  204.         INLINE    $303C, $0604, $ABC9;
  205.     
  206.     FUNCTION LoadIconCache(theRect: Rect;
  207.                             align: IconAlignmentType;
  208.                             transform: IconTransformType;
  209.                             theIconCache: Handle): OSErr;
  210.         INLINE    $303C, $0606, $ABC9;
  211.  
  212.     FUNCTION PlotIconMethod(theRect: Rect;
  213.                             align: IconAlignmentType;
  214.                             transform: IconTransformType;
  215.                             theMethod: IconGetter;
  216.                             yourDataPtr: UNIV Ptr): OSErr;
  217.         INLINE $303C, $0805, $ABC9;
  218.     
  219.     FUNCTION GetLabel(labelNumber: INTEGER; VAR labelColor: RGBColor;
  220.                             VAR labelString: Str255): OSErr;
  221.         INLINE $303C, $050B, $ABC9;
  222.     
  223.     FUNCTION PtInIconID(testPt: Point; iconRect: Rect;
  224.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  225.         INLINE $303C, $060D, $ABC9;
  226.  
  227.     FUNCTION PtInIconSuite(testPt: Point; iconRect: Rect;
  228.                     align: IconAlignmentType;
  229.                     theIconSuite: Handle): BOOLEAN;
  230.         INLINE $303C, $070E, $ABC9;
  231.  
  232.     FUNCTION PtInIconMethod(testPt: Point; iconRect: Rect;
  233.                     align: IconAlignmentType;
  234.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  235.         INLINE $303C, $090F, $ABC9;
  236.  
  237.     FUNCTION RectInIconID(testRect: Rect; iconRect: Rect;
  238.                     align: IconAlignmentType; iconID: INTEGER): BOOLEAN;
  239.         INLINE $303C, $0610, $ABC9;
  240.  
  241.     FUNCTION RectInIconSuite(testRect: Rect; iconRect: Rect;
  242.                     align: IconAlignmentType;
  243.                     theIconSuite: Handle): BOOLEAN;
  244.         INLINE $303C, $0711, $ABC9;
  245.  
  246.     FUNCTION RectInIconMethod(testRect: Rect; iconRect: Rect;
  247.                     align: IconAlignmentType;
  248.                     theMethod: IconGetter; yourDataPtr: Ptr): BOOLEAN;
  249.         INLINE $303C, $0912, $ABC9;
  250.  
  251.     FUNCTION IconIDToRgn(theRgn: RgnHandle; iconRect: Rect;
  252.                     align: IconAlignmentType; iconID: INTEGER): OSErr;
  253.         INLINE $303C, $0913, $ABC9;
  254.  
  255.     FUNCTION IconSuiteToRgn(theRgn: RgnHandle; iconRect: Rect;
  256.                     align: IconAlignmentType;
  257.                     theIconSuite: Handle): OSErr;
  258.         INLINE $303C, $0914, $ABC9;
  259.  
  260.     FUNCTION IconMethodToRgn(theRgn: RgnHandle; iconRect: Rect;
  261.                     align: IconAlignmentType;
  262.                     theMethod: IconGetter; yourDataPtr: Ptr): OSErr;
  263.         INLINE $303C, $0915, $ABC9;
  264.  
  265.     FUNCTION SetSuiteLabel(theSuite: Handle; theLabel: INTEGER): OSErr;
  266.         INLINE $303C, $0316, $ABC9;
  267.  
  268.     FUNCTION GetSuiteLabel(theSuite: Handle): INTEGER;
  269.         INLINE $303C, $0217, $ABC9;
  270.  
  271.     FUNCTION GetIconCacheData(theCache: Handle; VAR theData: Ptr): OSErr;
  272.         INLINE $303C, $0419, $ABC9;
  273.         
  274.     FUNCTION SetIconCacheData(theCache: Handle; theData: Ptr): OSErr;
  275.         INLINE $303C, $041A, $ABC9;
  276.         
  277.     FUNCTION GetIconCacheProc(theCache: Handle; VAR theProc: IconGetter): OSErr;
  278.         INLINE $303C, $041B, $ABC9;
  279.         
  280.     FUNCTION SetIconCacheProc(theCache: Handle; theProc: IconGetter): OSErr;
  281.         INLINE $303C, $041C, $ABC9;
  282.  
  283.     FUNCTION PlotIconHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  284.                     theIcon: Handle): OSErr;
  285.         INLINE $303C, $061D, $ABC9;
  286.  
  287.     FUNCTION PlotSICNHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  288.                     theSICN: Handle): OSErr;
  289.         INLINE $303C, $061E, $ABC9;
  290.  
  291.     FUNCTION PlotCIconHandle(theRect: Rect; align: INTEGER; transform: INTEGER;
  292.                     theCIcon: CIconHandle): OSErr;
  293.         INLINE $303C, $061F, $ABC9;
  294.  
  295.  { UsingIcons }
  296.  
  297.  
  298.  IMPLEMENTATION
  299. END.
  300.  
  301.  
  302.